/**
 * @copyright   2010-2017, The Titon Project
 * @license     http://opensource.org/licenses/BSD-3-Clause
 * @link        http://titon.io
 */

@include export("button-group") {
    $titon-button-group-modifiers: map-get($titon-button-group, "modifiers");

    #{generate-class-name($titon-button-group)} {
        @extend %placeholder-list;
        white-space: nowrap;
        display: inline-flex;
        vertical-align: middle;

        > li {
            position: relative;

            &:hover {
                z-index: 1;
            }
        }

        #{generate-class-name($titon-button)} {
            display: block;
            width: 100%;
        }

        // Space out groups
        & + & {
            margin-#{bidi-alignment()}: theme-setting("margin");
        }
    }

    //-------------------- Modifiers --------------------//

    @if (is-feature-enabled("all-modifiers") or index($titon-button-group-modifiers, "vertical")) {
        #{generate-class-name($titon-button-group, "", "vertical")} {
            flex-direction: column;
        }
    }

    @if (is-feature-enabled("all-modifiers") or index($titon-button-group-modifiers, "justified")) {
        #{generate-class-name($titon-button-group, "", "justified")} {
            width: 100%;
            display: flex;

            > li {
                flex-grow: 1;
            }
        }
    }
}
